package org.breathe.dynamic.thread.pool.core.parser.impl;

import com.google.common.collect.Lists;
import org.breathe.dynamic.thread.pool.core.parser.AbstractConfigParser;
import org.breathe.thread.pool.common.enums.ConfigFileTypeEnum;

import java.io.IOException;
import java.io.StringReader;
import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
 * @author: breathe
 * @createTime: 2025-04-14
 */
public class PropertiesConfigParser extends AbstractConfigParser {

    private static final List<ConfigFileTypeEnum> CONFIG_TYPE = Lists.newArrayList(ConfigFileTypeEnum.PROPERTIES);
    @Override
    public List<ConfigFileTypeEnum> type() {
        return CONFIG_TYPE;
    }

    @Override
    public Map<Object, Object> doParse(String content) throws IOException {
        Properties properties = new Properties();
        properties.load(new StringReader(content));
        return properties;
    }
}
